﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

using CSF.Security.Service;
using CSF.Security.BLL;
using CSF.Security.Data;

namespace CSF.Service.Accounts
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“UserRoleSvc”。
    public class UserRoleSvc : IUserRoleSvc
    {

        #region IDataEntityService<UserRole> 成员

        public List<Security.Data.UserRole> GetAll()
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.GetAll();
        }

        public int Insert(Security.Data.UserRole entity)
        {
            UserRoleBLL bll = new UserRoleBLL();
            bll.Insert(entity);
            return entity.Id;
        }

        #endregion

        #region IDataConfigService<UserRole> 成员

        public Security.Data.UserRole GetOneByCode(string code)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.GetOneByCode(code);
        }

        public List<Security.Data.UserRole> GetEnable()
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.GetEnable();
        }

        public List<Security.Data.UserRole> GetDisable()
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.GetDisable();
        }

        public List<Security.Data.UserRole> GetStartsWith(string keyword, bool isDisable)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.GetStartsWith(keyword, isDisable);
        }

        public bool Enable(Security.Data.UserRole t)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.Enable(t);
        }

        public bool Disable(Security.Data.UserRole t)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.Disable(t);
        }

        #endregion


        #region IUserRoleSvc 成员

        public IEnumerable<int> GetPermissions(int roleId)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.GetPermissions(roleId);
        }

        public void SetPermission(int roleId, IEnumerable<int> permissionIds, string createBy)
        {
            UserRoleBLL bll = new UserRoleBLL();
            bll.SetPermission(roleId, permissionIds, createBy);
        }

        #endregion

        #region IDataIdKeyService<UserRole> 成员

        public Security.Data.UserRole GetOneById(int id)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.GetOneById(id);
        }

        public bool UpdateById(Security.Data.UserRole t, int id)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.UpdateById(t, id);
        }

        public bool DeleteOneById(int id)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.DeleteOneById(id);
        }

        #endregion

        #region IDataIdKeyService<UserRole> 成员


        public int DeleteById(IEnumerable<int> ids)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.DeleteById(ids);
        }

        #endregion

        #region IDataIdKeyConfigService<UserRole> 成员

        public int SetDisable(IEnumerable<int> ids, bool isDisable, string modifyBy)
        {
            UserRoleBLL bll = new UserRoleBLL();
            return bll.SetDisable(ids, isDisable, modifyBy);
        }

        #endregion
    }
}
